package demoMod.nanaki.cards.nanaki;

import com.megacrit.cardcrawl.actions.common.DrawCardAction;
import com.megacrit.cardcrawl.characters.AbstractPlayer;
import com.megacrit.cardcrawl.core.CardCrawlGame;
import com.megacrit.cardcrawl.localization.CardStrings;
import com.megacrit.cardcrawl.monsters.AbstractMonster;
import demoMod.nanaki.NanakiMod;
import demoMod.nanaki.utils.GetWaitAction;

public class FutureReverberation extends AbstractNanakiCard {
    public static final String ID = NanakiMod.makeID("FutureReverberation");

    private static final CardStrings cardStrings = CardCrawlGame.languagePack.getCardStrings(ID);
    public static final String NAME = cardStrings.NAME;
    public static final String DESCRIPTION = cardStrings.DESCRIPTION;
    public static final String IMG_PATH = "cards/FutureReverberation";

    private static final CardType TYPE = CardType.SKILL;
    private static final CardRarity RARITY = CardRarity.UNCOMMON;
    private static final CardTarget TARGET = CardTarget.NONE;

    private static final int COST = 0;

    public FutureReverberation() {
        super(ID, NAME, NanakiMod.getResourcePath(IMG_PATH), COST, DESCRIPTION, TYPE, RARITY, TARGET);
        this.baseMagicNumber = this.magicNumber = 1;
        this.exhaust = true;
    }

    @Override
    public Runnable getUpgradeAction() {
        return () -> upgradeMagicNumber(1);
    }

    @Override
    public void use(AbstractPlayer p, AbstractMonster m) {
        addToBot(new DrawCardAction(1, GetWaitAction.doAndWait(() -> {
            if (!DrawCardAction.drawnCards.isEmpty()) {
                if (DrawCardAction.drawnCards.get(0).type == CardType.SKILL) {
                    addToTop(new DrawCardAction(this.magicNumber));
                }
            }
        }, 0.0F)));
    }
}
